import Watcher from '../watcher.js'

/*
 * @Author: zengwj
 * @Date: 2022-08-10 15:01:29
 * @LastEditors: zengwj
 * @LastEditTime: 2022-08-10 15:02:55
 * @Description:
 */
export default function compileTextNode(node, vm) {
	// <span>{{ key }}</span>
	const key = RegExp.$1.trim()
	function cb() {
		node.textContent = JSON.stringify(vm[key])
	}
	// 实例化 Watcher，执行 cb，触发 getter，进行依赖收集
	new Watcher(cb)
}
